package be.jabapage.gui;

import javax.swing.JFrame;
import javax.swing.table.AbstractTableModel;

import org.apache.log4j.Logger;

import be.jabapage.util.PropertiesSingleton;

public abstract class AbstractSnookerTableModel extends AbstractTableModel {
	protected JFrame frame;
	protected PropertiesSingleton properties = PropertiesSingleton.getInstance();
	protected String titles[];
	protected Logger logger = Logger.getRootLogger();
	protected Object data[][];

	public AbstractSnookerTableModel() {
		// TODO Auto-generated constructor stub
	}

	public abstract void refreshData();

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.swing.table.AbstractTableModel#getColumnClass(int)
	 */
	@Override
	public Class<?> getColumnClass(int column) {
		// TODO Auto-generated method stub
		return getValueAt(0, column).getClass();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.swing.table.AbstractTableModel#isCellEditable(int, int)
	 */
	@Override
	public boolean isCellEditable(int arg0, int arg1) {
		// TODO Auto-generated method stub
		return super.isCellEditable(arg0, arg1);
	}


	public int getColumnCount() {
		return titles.length;
	}


	public int getRowCount() {
		return data.length;
	}


	public Object getValueAt(int r, int c) {
		return data[r][c];
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.swing.table.AbstractTableModel#getColumnName(int)
	 */
	@Override
	public String getColumnName(int column) {
		return titles[column];
	}

}
